<?php
/**
 * 验证
 */

namespace Common\Controller\App;

use Common\Model\ProductCartModel;
use Common\Model\TarentoModel;
use Think\Controller;

class CommonController extends Controller
{

    static public $shop_id;

    public function __construct()
    {

        parent::__construct();

        $this->checkLogin();

    }
    /**
     * 检查是否有店铺id
     */
    public function checkLogin()
    {

        $shop_id = I('post.shop_id');
        if(empty($shop_id)){
            $shop_id = 14441;
        }

        session('member_id',14441); //198787
        $member_id = session('member_id');
        if(empty($member_id)){
            $this->ajaxReturn(['code'=>301,'msg'=>'您好，你还未登录，请先登录']);
        }
        $model = new TarentoModel();
        $info = $model->getRow($member_id);
        if($info['level']==1 || $info['level']==2){
            self::$shop_id = $member_id;
        }else{
            self::$shop_id = $shop_id;
        }

    }


}